<style>
    .article2{
        margin: 0 auto;
        width: 600px;
        border: solid 1px #d9d9d9;
        box-shadow: 2px 2px 2px #999999;
        margin-top: 50px;
        margin-bottom: 50px;
    }
    .form{
        width: 500px;
        margin: 0 auto;
    }
</style>
<script src="JSPath/jquery-1.11.3.js"></script>
<script>
    $(function(){
//            $.ajax()
        $("#username").blur(function(){
            var v = $(this).val();
            console.log(v.length);
            if(v.length>3){
                $("#username_msg").html('');
                var url ='/thinkphp/Blog/Index/checkUserAjax';
                var sData = {
                    name:v
                };
                $.ajax(url,{
                    data:sData,
                    dataType:'json',
                    success:function(d){
                        if (d.status == 1){
                            $("#msg").html(d.msg);
                            $("#btn").attr('disabled',false);
                        } else {
                            $("#msg").html(d.msg);
                            $("#btn").attr('disabled',true);
                        }
                    }
                })
            } else {
                $("#username_msg").html('用户名必须大于6个字符');
            }
        })
    });
</script>

<div class="article2">
    <div class="form">
        <h2 style="text-align: center">注册</h2>
        <div class="clr"></div>
        <form action="#" method="post" id="sendemail">
            <ol>
                <li>
                    <label for="username">用户名 (required)</label>
                    <input id="username" name="username" class="text" type="text"/>
                    <span id="username_msg"></span>
                </li>
                <li>
                    <label for="email">邮箱 Address (required)</label>
                    <input id="email" name="email" class="text" type="text"/>
                </li>
                <li>
                    <label for="password">密码 (required)</label>
                    <input id="password" name="password" class="text" type="password"/>
                </li>
                <li>
                    <label for="password2">确认密码 (required)</label>
                    <input id="password2" name="password2" class="text" type="password"/>
                </li>
                <li>
                    <input type="image" name="imageField" id="imageField" src="IMAGEPath/submit.gif" class="send"/>
                    <div class="clr"></div>
                </li>
            </ol>
        </form>
    </div>

</div>





